package com.jltx.xq.appexitpro;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

/**
 * @author jltxseo
 * @date 2017/03/24.
 * @description:
 */

public class MainActivityC extends BaseAppCompatActivity{
    private TextView tv;
    private Button nextBtn;
    private Button exitBtn;
    private Button exitBtn1;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_c);

        tv = (TextView)findViewById(R.id.text);
        tv.setText(tv.getText().toString()+":"+this.toString());
        nextBtn = (Button)findViewById(R.id.next_btn);
        exitBtn = (Button)findViewById(R.id.exit_btn);
        exitBtn1 = (Button)findViewById(R.id.exit_btn1);
        if(nextBtn != null){
            nextBtn.setOnClickListener(onClickListener);
        }
        exitBtn.setOnClickListener(onClickListener);
        exitBtn1.setOnClickListener(onClickListener);
    }


    private View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            switch (v.getId()){
                case R.id.next_btn:
                    Intent intent = new Intent(MainActivityC.this,MainActivityD.class);
                    intent.putExtra(Constance.FIRST_DATA_KEY,"come form MainActivityC");
                    intent.putExtra(Constance.SECONDE_DATA_KEY,"come form MainActivityC");
                    startActivityForResult(intent,Constance.MAINACTIVITYD_REQUEST_CODE);
                    break;
                case R.id.exit_btn:
                    android.os.Process.killProcess(android.os.Process.myPid());
                    break;
                case R.id.exit_btn1:
                    App.getApp().exitApp();
                    break;
                default:
                    break;
            }
        }
    };
}
